<%@page import="java.sql.*"%>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<h1>成语数据库中的20条记录</h1>
<%
	String url = "jdbc:mysql://localhost:3306/db?serverTimezone=GMT%2B8";
//1.加载驱动
	Class.forName("com.mysql.cj.jdbc.Driver");
//2.创建连接
	Connection cn=DriverManager.getConnection(url, "root", "12qwas");
//3.创建sql插入语句并设定参数的值
	PreparedStatement ps = cn.prepareStatement("select * from chengyu limit 1000,15");
//4.执行指令获取记录
	ResultSet rs = ps.executeQuery();
//5.遍历记录集并显示
	while(rs.next()){
		String cy = rs.getString("cy");
		out.println(cy+"<br>");
	}
	rs.close();
	ps.close();
	cn.close();
%>
</body>
</html>